home *** CD-ROM | disk | FTP | other *** search
- IFND EXEC_MACROS_I
- EXEC_MACROS_I SET 1
- **
- ** $Filename: exec/macros.i $
- ** $Release: 1.4 $
- ** $Revision: 36.2 $
- ** $Date: 89/12/17 23:56:00 $
- **
- ** Handy macros for assembly language programmers.
- **
- ** (C) Copyright 1985,1986,1987,1988,1989 Commodore-Amiga, Inc.
- ** All Rights Reserved
- **
-
- ;How detailed debugging information should be. Zero is no debugging.
- IFND DEBUG_DETAIL
- DEBUG_DETAIL SET 0
- ENDC
-
- JSRLIB MACRO
- XREF _LVO\1
- jsr _LVO\1(a6)
- ENDM
-
- JMPLIB MACRO
- XREF _LVO\1
- jmp _LVO\1(a6)
- ENDM
-
- BSRSELF MACRO
- XREF \1
- bsr \1
- ENDM
-
- BRASELF MACRO
- XREF \1
- jsr \1
- ENDM
-
- BLINK MACRO
- IFNE DEBUG_DETAIL
- bchg.b #1,$bfe001 ;Toggle the power LED
- ENDC
- ENDM
-
- CLEAR MACRO
- moveq.l #0,\1
- ENDM
-
- CLEARA MACRO
- suba.l \1,\1 ;Quick way to put zero in an address register
- ENDM
-
- *************************************************************************
- IFND PRINTF
- PRINTF MACRO ; level,<string>,...
- IFGE DEBUG_DETAIL-\1
- XREF kprint_macro
- PUSHCOUNT SET 0
-
- IFNC '\9',''
- move.l \9,-(sp)
- PUSHCOUNT SET PUSHCOUNT+4
- ENDC
-
- IFNC '\8',''
- move.l \8,-(sp)
- PUSHCOUNT SET PUSHCOUNT+4
- ENDC
-
- IFNC '\7',''
- move.l \7,-(sp)
- PUSHCOUNT SET PUSHCOUNT+4
- ENDC
-
- IFNC '\6',''
- move.l \6,-(sp)
- PUSHCOUNT SET PUSHCOUNT+4
- ENDC
-
- IFNC '\5',''
- move.l \5,-(sp)
- PUSHCOUNT SET PUSHCOUNT+4
- ENDC
-
- IFNC '\4',''
- move.l \4,-(sp)
- PUSHCOUNT SET PUSHCOUNT+4
- ENDC
-
- IFNC '\3',''
- move.l \3,-(sp)
- PUSHCOUNT SET PUSHCOUNT+4
- ENDC
-
- movem.l a0/a1,-(sp)
- lea.l PSS\@(pc),A0
- lea.l 4*2(SP),A1
- BSR kprint_macro
- movem.l (sp)+,a0/a1
- bra.s PSE\@
-
- PSS\@ dc.b \2
- IFEQ (\1&1) ;If even, add CR/LF par...
- dc.b 10,13
- ENDC
- dc.b 0
- ds.w 0
- PSE\@
- adda.l #PUSHCOUNT,sp
- ENDC ;IFGE DEBUG_DETAIL-\1
- ENDM ;PRINTF MACRO
- ENDC ;IFND PRINTF
-
-
- ;----------------------------------------------------------------------------
- ;Push a set of registers onto the stack - undo with POPM.
- ;These macros do not nest.
- ; PUSHM d2/a2/a5
- ; ...code...
- ; POPM
- ; RTS
- ;
- PUSHM_COUNT SET 0
- PUSHM MACRO
- IFGT NARG-1
- FAIL !!!! TOO MANY ARGUMENTS TO PUSHM !!!!
- ENDC
- PUSHM_COUNT SET PUSHM_COUNT+1
- PUSHM_\*VALOF(PUSHM_COUNT) REG \1
- movem.l PUSHM_\*VALOF(PUSHM_COUNT),-(sp)
- ENDM
- ;
- ;Undo most recent PUSHM
- ;
- POPM MACRO
- movem.l (sp)+,PUSHM_\*VALOF(PUSHM_COUNT)
- ENDM
- ;----------------------------------------------------------------------------
-
-
- ENDC ; EXEC_MACROS_I
-